package com.project.shiro.controller;

import com.project.common.core.utils.exception.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 控制器编码范例
 *
 * @author wyy
 * @date 2019-08-20 19:57
 */
@Api(value = "shiro权限测试", tags = "shiro权限测试")
@RestController("adminAuthController")
@RequestMapping("/admin")
public class AuthController extends BaseController {

    /**
     * 测试权限
     *
     * @return
     */
    @ApiOperation(value = "test", notes = "测试权限", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "test", value = "测试参数", dataType = "String")
    })
    @RequiresPermissions({"admin:test1"})
    @PostMapping(value = "/test")
    public Result<String> test() {
        return getResult(123);
    }

}
